#ifndef _MQTT_MSG_H_
#define _MQTT_MSG_H_

#include "common.h"
#include "mosquitto.h" /* mqtt lib header */
#include <queue>

namespace mqtt {
class Mqtt {
public:
    Mqtt(void);
    bool Publish(const char *topic, const char *data);
    bool Subscribe(const char *topic);
    bool UnSubscribe(const char *topic);
    ~Mqtt();
    static bool mqtt_connect_flag; /* mqtt是否连接标志,true:连接,false:未连接 */
    static bool MqttIsConnect(void);
    static void Mosquitto_version(void);
private:
    struct mosquitto *local_mqtt_id; /* mqtt句柄 */
    int mqtt_pub_id;                 /* mqtt发布id */
};

extern bool MqttMsgQueueIsEmpty(void);
extern msg_t &MqttMsgQueueGetItem(void);
extern void MqttMsgQueuePop(void);
extern int MqttMsgQueueGetCount(void);
}

#endif
